package 代码记录.校招笔试真题.笔试真题_2023.恒生电子;

import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

/**
 * @author zx
 * @create 2023-03-23 19:49
 * 100%
 */
public class Test1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        if(isOk(str)){
            for(int i = 0;i < str.length();i++){
                char c = str.charAt(i);
                if(c == '{' || c == '}'){
                    System.out.print("红");
                }else if(c == '[' || c == ']'){
                    System.out.print("黄");
                }else if(c == '(' || c == ')'){
                    System.out.print("蓝");
                }
            }
        }else{
            System.out.println("输入错误");
        }
    }
    private static boolean isOk(String str){
        Deque<Character> stack = new ArrayDeque<>();
        for(int i = 0;i < str.length();i++){
            char c = str.charAt(i);
            if(c == '{' || c == '[' || c == '('){
                stack.push(c);
            }
            if(c == '}' && stack.peek() == '{'){
                stack.pop();
            }else if(c == ')' && stack.peek() == '('){
                stack.pop();
            }else if(c == ']' && stack.peek() == '['){
                stack.pop();
            }
        }
        return stack.isEmpty();
    }
}
